//
// RS Game Framework
// Copyright © 2010 Jedd Haberstro
// jhaberstro@gmail.com
// 
// $Id:
//

#ifndef RS_GRAPHICS_RESOURCE_HPP
#define RS_GRAPHICS_RESOURCE_HPP

#include "rs/graphics/GraphicsForwards.hpp"
#include "rs/graphics/ResourceDescription.hpp"
#include "rs/reflection/Reflection.hpp"
#include "rs/ReferenceCounted.hpp"

namespace rs
{
    namespace graphics
    {
        class Resource : public ReferenceCounted
        {
            RS_DECLARE_POLYMORPHIC_REFLECTION();
            
        public:
            
            Resource();
            
            Resource(ResourceDescription const& description);
            
            virtual ~Resource();
            
            ResourceAccess::Enum GetAccess() const;
            
            ResourceType::Enum GetType() const;
            
            ResourceUsage::Enum GetUsage() const;
            
        private:
            
            UInt8 access_;
            UInt8 type_;
            UInt8 usage_;
        };
        
                
        inline Resource::Resource()
        : access_(ResourceAccess::None),
          type_(ResourceType::Unknown),
          usage_(ResourceUsage::Default) {
        }
        
        inline Resource::Resource(ResourceDescription const& description)
        : access_(static_cast< UInt8 >(description.GetAccess())),
          type_(static_cast< UInt8 >(description.GetType())),
          usage_(static_cast< UInt8 >(description.GetUsage())) {
        }
        
        inline Resource::~Resource() {
        }
        
        inline ResourceAccess::Enum Resource::GetAccess() const {
            return static_cast< ResourceAccess::Enum >(access_);
        }
        
        inline ResourceType::Enum Resource::GetType() const {
            return static_cast< ResourceType::Enum >(type_);
        }
        
        inline ResourceUsage::Enum Resource::GetUsage() const {
            return static_cast< ResourceUsage::Enum >(usage_);
        }
    }
}

#endif // RS_GRAPHICS_RESOURCE_HPP